package com.umpay.junit.test.xcx.dh;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;

import javax.crypto.IllegalBlockSizeException;

import org.junit.Test;

import com.umfwechat.util.DesIDUtil;
import com.umfwechat.util.DesUtil;
import com.umfwechat.util.GetWxAndLmf;

public class test {
	public static void main(String[] args){
		String ss = "240&00&00";
		
		List<String> transResult  = GetWxAndLmf.getTransResult(ss.replace("&",""));
		 
		if(transResult==null){//行业类目没有找到
			System.out.println( "没有找到对应行业类目");
		}else{
			System.out.println( "：对应支付宝："+transResult.get(0)+"  对应微信:"+transResult.get(1));
		}
	}
	 /**
     * 加解密身份证号
     */
    @Test
    public void demo1(){
    	DesUtil desUtil = new DesUtil("KSagZxG3");
    	String id = null;
		try {
			id = desUtil.dec_des("3d4f2bf07dc1be38b20cd6e46949a1071f9d0e3d");
			System.out.println(id);
			String des = desUtil.enc_des("411123");
			System.out.println(des);
		} catch (IllegalBlockSizeException | IllegalArgumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
    @Test
    public void demo2() throws IOException, IllegalBlockSizeException, IllegalArgumentException{ 
    	
    	
//    	DesUtil desUtil = new DesUtil("KSagZxG3");
//    	String id = null;
//    	File file =new File("D:/aa.txt");
//        File file2 =new File("D:/aa2.txt");
//        String ss =null;
//        try {
//            BufferedReader bf = new BufferedReader(new FileReader(file));
//            BufferedWriter s = new BufferedWriter(new FileWriter(file2));
//            String line;
//            // 读取每行数据
//            while ((line = bf.readLine()) != null) {
//            	id = desUtil.dec_des(line);
//                System.out.println(line);
//                //写入
//                s.write(id);
//                s.newLine();
//                s.flush();
//            }
//        } catch (FileNotFoundException e) {
//            e.printStackTrace();
//        }
    	
        String s = "9999";
        System.out.println( Double.valueOf(s)/1000);
        
        //结果 两位小数、四舍五入 更多详细精度计算方式请参考API BigDecimal-字段摘要
        BigDecimal v3 = new BigDecimal(15).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_HALF_UP); 
        System.out.println(v3);
       
    }
}
